package il.ac.braude.sona.gui.forms.myforms;

import il.ac.braude.sona.constants.ButtonPermission;
import il.ac.braude.sona.constants.Resources;
import il.ac.braude.sona.gui.forms.FormFrame;
import il.ac.braude.sona.gui.forms.FormPanel;
import il.ac.braude.sona.gui.forms.questions.QButton;
import il.ac.braude.sona.gui.forms.questions.QCheckBox;

import java.awt.event.ActionListener;

/**
 * Class that's in charge of showing MakeDesicion GUI.
 * @author  Ofek Ron
 * @author Avihay Avitan
 * @author Nitzan Inbar
 * @author Sasha Rozenthal
 * Laboratory in Software Engineering,Ort Braude College.</p>
 *
 */
@SuppressWarnings("serial")
public class MakeDecisionForm extends  FormFrame {
	public FormPanel form;
	/**
	 * Shows the make decision form.
	 * @param reqid the request ID to show.
	 */
	public MakeDecisionForm(String reqid) {
		super(ButtonPermission.MakeDecision, Resources.Strings.OK);
		form = new FormPanel();
		form.addTitleWithUnderline("Set board decision for request: "+reqid);
		form.addQuestion(new QCheckBox(Resources.Strings.Execute));
		form.addQuestion(new QCheckBox(Resources.Strings.Reject));
		form.addTitle("Note: Any decision will requestet for approval by Board Chairman");
		setFormPanel(form);
	}

	public MakeDecisionForm(String id, String decision,ActionListener actionListener) {
		super(ButtonPermission.ApproveBoardDecision, Resources.Strings.Approve);
		form = new FormPanel();
		form.addTitleWithUnderline("Approve board decision for request: "+id);
		form.addTitle("Board decision is: "+decision.toUpperCase());
		form.addQuestion(new QButton(Resources.Strings.ChangeDecision,actionListener));
		setFormPanel(form);		
	}
	
	public void changeDecision(String id, String decision,ActionListener actionListener) {
		form.removeAll();
		form = new FormPanel();
		form.addTitleWithUnderline("Approve board decision for request: "+id);
		form.addTitle("Board decision is: "+decision);
		form.addQuestion(new QButton(Resources.Strings.ChangeDecision,actionListener));
		setFormPanel(form);		
	}
	
	

}
